<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function send_email($to, $content){
    $CI =& get_instance();

    error_reporting(E_ERROR);
    $CI->load->library('phpmailer');

    $mail = new PHPMailer();

    $mail->IsSMTP();
    $mail->SMTPAuth   = true;                  // enable SMTP authentication
    $mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
    $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
    $mail->Port       = 465;                   // set the SMTP port

    $mail->Username   = "overdue.notice.pp.uksw@gmail.com";  // GMAIL username
    $mail->Password   = "overduenotice";            // GMAIL password

    $mail->From       = "overdue.notice.pp.uksw@gmail.com";
    $mail->FromName   = "Tester";
    $mail->Subject    = "This is the subject";
    $mail->Body       = "Woi, ando. So bole mandi jo!";                      //HTML Body
    $mail->AltBody    = "This is the body when user views in plain text format"; //Text Body
    //print_r($mail);
    $mail->WordWrap   = 50; // set word wrap

    $mail->AddAddress("kahosadi@gmail.com");
    //$mail->AddReplyTo("username@somedomain.com","sender name");
    //$mail->AddAttachment("/path/to/file.zip");             // attachment
    //$mail->AddAttachment("/path/to/image.jpg", "new.jpg"); // attachment

    $mail->IsHTML(true); // send as HTML

    if(!$mail->Send()) {
      echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
      echo "Message has been sent";
    }
}

/* End of file myemail_helper.php */
/* Location: ./application/helpers/myemail_helper.php */
